'''
Created on Jun 13, 2010

@author: oabalbin
'''
class interaction:
    def __init__(self, item_id_a, item_id_b, neighborhood, fusion, cooccurence, coexpression, 
                 experimental, indatabase, textmining, combined_score, item_id_a_hugo, item_id_b_hugo):
        self.item_id_a, self.item_id_b, self.neighborhood, self.fusion, self.cooccurence, self.coexpression, self.experimental, \
        self.indatabase, self.textmining, self.combined_score, self.item_id_a_hugo, self.item_id_b_hugo = \
        item_id_a, item_id_b, neighborhood, fusion, cooccurence, coexpression, experimental, indatabase, textmining, combined_score, \
        item_id_a_hugo, item_id_b_hugo
        
        self.mode, self.action, self.is_acting = '','',0.0
        
    def update_mode_action(self,mode, action, isacting):
        self.mode, self.action, self.is_acting = mode, action, int(isacting)
        
        if self.mode =="expression":
            if self.is_acting==1:
                self.item_id_b = self.item_id_b+'_'+"mrna"
                self.item_id_b_hugo = self.item_id_b_hugo+'_'+"mrna"
                print self.item_id_a_hugo, self.item_id_b_hugo
            elif self.is_acting==0:
                '''
                when self.is_acting=0'
                Answer from STRING db developers
                > This means that if a_mode is expression, a_action is empty and a_is_acting
                > is 0, it means that I can not infer that the gene B is  actually being
                > expressed ?
                yes, at it might be that B is causing the expression of A to change.
                Then "a_is_acting" will be set for the edge B-A, but not for A-B.
                ...
                I need to change the direction of the interaction because this edge is directed from
                the protein to the mrna
                '''
                a_temp1,a_temp2 = self.item_id_a,self.item_id_a_hugo
                b_temp1,b_temp2 = self.item_id_b,self.item_id_b_hugo
                self.item_id_a, self.item_id_a_hugo = b_temp1, b_temp2
                self.item_id_b, self.item_id_b_hugo = a_temp1, a_temp2
                
                self.item_id_b = self.item_id_b+'_'+"mrna"
                self.item_id_b_hugo = self.item_id_b_hugo+'_'+"mrna"
                print self.item_id_a_hugo, self.item_id_a_hugo

                
            
    
    def get_attributes_dict(self):
        return self.__dict__
    
 
